package com.zx.mvcframework.handle;

import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;


/**
 * 封装handler方法相关的信息
 */
public class MethodHandler {

    private  Object controller; // method.invoke(obj,)

    private   Class<?> controllerType;

    private Method method;


    private Map<String,Integer> paramIndexMapping; // 参数顺序,是为了进行参数绑定，key是参数名，value代表是第几个参数 <name,2>


    public MethodHandler(Object controller, Method method ,Class<?> controllerType) {
        this.controller = controller;
        this.method = method;
        this.controllerType = controllerType;
        this.paramIndexMapping = new HashMap<>();
    }

    public Class<?> getControllerType() {
        return controllerType;
    }

    public void setControllerType(Class<?> controllerType) {
        this.controllerType = controllerType;
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }


    public Map<String, Integer> getParamIndexMapping() {
        return paramIndexMapping;
    }

    public void setParamIndexMapping(Map<String, Integer> paramIndexMapping) {
        this.paramIndexMapping = paramIndexMapping;
    }
}
